package twentytwentyone_3;

/**
 * @Author: Zahi
 * @Description:
 * @Date Created in 2021-03-15 13:03
 * @Modified By:
 */
public class ReverseWords_557 {
    public static void main(String[] args){
        String s = "Let's take LeetCode contest";
        System.out.println(reverseWords(s));
    }

    public static String reverseWords(String s){
        StringBuilder result = new StringBuilder();
        String[] s1 = s.split(" ");
        for (int i = 0; i < s1.length; i++) {
            result.append(new StringBuilder(s1[i]).reverse());
            if (i != s1.length - 1){
                result.append(" ");
            }
        }
        return result.toString();
    }
}
